package org.longgang.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.longgang.bean.Position;
import org.longgang.bean.PositionResume;
import org.springframework.stereotype.Repository;

/**
 * PositionResumeDAO继承基类
 */
@Repository
@Mapper
public interface PositionResumeDAO extends MyBatisBaseDao<PositionResume, PositionResume> {

	@Insert({ "INSERT INTO position_resume(positionid,userid,`status`) VALUES(#{positionid},#{userid},0)" })
	Integer insertPositionResume(PositionResume info);

	@Select({ "select * from position_resume where positionid=#{positionid} and userid=#{userid} " })
	PositionResume selectPositionResumeS(PositionResume info);
	
	@Select({ "select * from position_resume where userid=#{userid} and `status`=#{status} order by deliverydate desc" })
	List<PositionResume> selectPositionResumeByU(PositionResume info);

	@Select({ "select * from position_resume where positionid=#{positionid} and `status`=#{status} order by deliverydate desc" })
	List<PositionResume> selectPositionResumeByP(PositionResume info);

	@Update({ "update position_resume set `status`=#{status} where positionid=#{positionid} and userid=#{userid}" })
	Integer updatePositionResume(PositionResume info);
	
	@Select({ "select sum(1) from  position_resume where positionid=#{positionid} and `status`=#{status}"})
	Integer sumPRByP(PositionResume info);
	
	@Select({ "select sum(1) from  position_resume where userid=#{userid} and `status`=#{status}"})
	Integer sumPRByU(PositionResume info);
	
	@Update({ "update position_resume set `status`=#{status},b1=#{b1} where positionid=#{positionid} and userid=#{userid}" })
	Integer rePositionResume(PositionResume info);
}